package cn.yeziji.forum.vo.chatroom;

import cn.yeziji.forum.vo.user.UserMsgVO;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 私聊聊天室的联系用户
 *
 * @author gzkemays
 * @since 2022/12/03 11:52 AM
 */
@Data
@NoArgsConstructor
public class PrivateChatContactVO {
  String username;
  String nickname;
  String avatar;
  String desc;
  String level;
  String lastChat;
  String lastChatDate;
  Integer noticeNum;

  public PrivateChatContactVO(UserMsgVO vo) {
    this.nickname = vo.getNickname();
    this.avatar = vo.getAvatar();
    this.desc = vo.getDesc();
    this.level = vo.getLevel();
  }

  public static List<PrivateChatContactVO> converterPrivateChatContactVos(List<UserMsgVO> vos) {
    List<PrivateChatContactVO> list = new ArrayList<>();
    for (UserMsgVO vo : vos) {
      list.add(new PrivateChatContactVO(vo));
    }
    return list;
  }

  public void noticeNumberAdd() {
    if (this.noticeNum == null) {
      this.noticeNum = 0;
    }
    this.noticeNum++;
  }
}
